package com.parenting.controller;


import com.parenting.oauth2.config.AuthUtil;
import com.parenting.response.OrderStatisticsResponse;
import com.parenting.service.OrdersService;
import com.parenting.util.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 */
@RestController
@Api(tags = "首页-订单统计", description = "订单类统计")
@RequestMapping("/order")
public class OrdersStatisticsController {

    @Autowired
    private OrdersService ordersService;

    @ApiImplicitParam(name = "type", value = "订单统计类型值:today、month、year",
            required = true, dataType = "String")
    @GetMapping("/statistics/{type}")
    public  Result<OrderStatisticsResponse> situation(@PathVariable("type") String type){
        OrderStatisticsResponse situation = ordersService.situation(type,
                AuthUtil.getUserInfo().getShopId());
        return Result.buildSuccess(situation);
    }



    
}
